package com.zjitc.controller;

import com.zjitc.model.Product;
import com.zjitc.service.ProductService;
import java.lang.ProcessBuilder.Redirect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/4/25 15:53
 * @description:
 */
@Controller
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private ProductService productService;

    @RequestMapping("/findByPid")
    private ModelAndView findByPid(Integer pid){
      ModelAndView modelAndView=new ModelAndView();
      Product product=productService.findByPid(pid);
      modelAndView.addObject("pl",product);
      modelAndView.setViewName("/user/product.jsp");
      return modelAndView;
    }

}
